
if (!$this.choose.length){
    $this.$message.warning($this.$t('table.basic.btn.remove.msg'))
}else{
    for (let i = 0; i < $this.choose.length; i++) {
        let url = $this.$util.getAPI_URL();
        let formData=new FormData();
        formData.append("id",$this.choose[i].ID);
        url = url.replace("api", "task/taskbyId");
        $this.$http.post(url,formData).then(async (res) => {
            if (res.data.code === 280) {
                if (res.data.data[0]["input_1711518795031_xvIfW"] !== "3") {
                    if (res.data.data[0]["number_1711505160101_Zy3nM"] < 100) {
                        $this.$message.error("【" + res.data.data[0]["input_1711439260720_6QPqX"] + "】任务进度未完成");
                    } else {
                        let xmjl = ""
                        let xmjlId = ""
                        let formData2 = new FormData();
                        let tempWhere2 = [{
                            "key": $this.$util.uuid(),
                            "str": "commonNumber_1755322221490_jdSWe",
                            "condition": "eq",
                            "t_value": res.data.data[0]["input_1718345101976_ZNGth"],
                            "whId": "146e94d14bee3637cf5bda8953c02ee2",
                            "type": "head"
                        }]
                        formData2.append("where", JSON.stringify(tempWhere2));
                        formData2.append("authority", "false");
                        // 根据表单应用标识
                        await $this.$http.post('/wind/tableByWhId/146e94d14bee3637cf5bda8953c02ee2', formData2).then(res => {
                            if (res.data.code === 280) {
                                let data = res.data.list;
                                xmjl = data[0].systemSelect_1753889252822_fmnil;
                                xmjlId = data[0].systemSelect_1753889252822_fmnil_ID;
                            } else {
                                $this.$message.error(res.data.msg ? res.data.msg : $this.$t('result.error.common.msg'));
                            }
                        }).catch(e => {
                            $this.$message.error(e.message);
                        });
                        let id = $this.$util.uuid();
                        let saveTask = {
                            "bill_id": id,
                            "bill_no": $this.$util.uuid(),
                            "bill_type": "a8ccd5df2e29ddee6c11f52d033fb812",
                            "create_company_id": $this.$store.state.user.user.companyId,
                            "create_company_name": $this.$store.state.user.user.companyName,
                            "create_date": $this.$util.getFormatDate(),
                            "create_dept_id": $this.$store.state.user.user.organizationId,
                            "create_dept_name": $this.$store.state.user.user.organizationName,
                            "create_user_id": $this.$store.state.user.user.userId,
                            "create_user_name": $this.$store.state.user.user.nickName,
                            "input_1711511883229_K1CSv": res.data.data[0]["commonNumber_1711532225675_bFKuy"],//任务编号
                            "input_1711511885245_bPKSS": res.data.data[0]["input_1711439260720_6QPqX"],//任务名称
                            "input_1711511891711_0MHzG": res.data.data[0]["systemSelect_1711504973428_U0If2"],//派发人
                            "input_1711511895002_4cA9a": res.data.data[0]["systemSelect_1711439399614_qXQ72"],//负责人
                            "input_1711512076065_Bnjyx": res.data.data[0]["bill_id"],//任务ID
                            "input_1711613718998_wsgUf": res.data.data[0]["input_1711505053915_0ebmW"],//提交时间
                            "input_1712807068685_m72Gk": res.data.data[0]["systemSelect_1711439399614_qXQ72_ID"],//执行人ID
                            "systemSelect_1755335343088_tlKt7": res.data.data[0]["systemSelect_1711439400905_v5lzI"],//审核人
                            "systemSelect_1755335343088_tlKt7_ID": res.data.data[0]["systemSelect_1711439400905_v5lzI_ID"],//审核人ID
                            "input_1755505311352_NPuVI": res.data.data[0]["input_1718345101976_ZNGth"],//项目编号
                            "input_1755505312916_MOLTZ": res.data.data[0]["input_1718345101976_PBcTl"],//项目名称
                            "select_1761115990017_gXoiU": res.data.data[0]["select_1711505903223_YWk8w"],//任务类型
                            "systemSelect_1761191649666_6KMrS": xmjl,//项目经理
                            "systemSelect_1761191649666_6KMrS_ID": xmjlId,//项目经理ID
                        }

                        let files = []
                        let formData1 = new FormData()
                        formData1.append('obj', JSON.stringify(saveTask))
                        formData1.append("files", JSON.stringify(files))
                        $this.$http.post("/wind/form/save/" + "review" + "/" + "add", formData1).then(res1 => {
                            if (res1.data.code === 280) {
                                $this.$http.post("/activiti/createFlow/" + "a8ccd5df2e29ddee6c11f52d033fb812" + "/" + id).then(res2 => {
                                    if (res2.data.code === 280) {
                                        let url1 = $this.$util.getAPI_URL();
                                        url1 = url1.replace("api", "task/updateTaskStatus");
                                        formData.append("status", "3");
                                        $this.$http.post(url1, formData).then((resa) => {
                                            if (resa.data.code === 280) {
                                                $this.$message.success("提交成功")
                                                $this.refreshFather(true);

                                            } else {
                                                $this.$message.error("提交失败")
                                            }
                                        })
                                    } else {
                                        $this.$message.error("发起【审核】流程失败")
                                    }
                                }).catch(e => {
                                    $this.$message.error(e.message)
                                });
                            } else {
                                $this.$message.errr("系统错误，请联系管理员!!!");
                            }
                        }).catch(e => {
                            $this.$message.error(e.message);
                        });
                    }
                }
                else{
                    $this.$message.warning("任务已提交审核");
                }
            }
        })
    }
}

/*
      if (!$this.choose.length){
        $this.$message.warning($this.$t('table.basic.btn.remove.msg'))
      }else{
        for (let i = 0; i < $this.choose.length; i++) {
          let url = $this.$util.getAPI_URL();
          let formData=new FormData();
          formData.append("id",$this.choose[i].ID);
          url = url.replace("api", "task/taskbyId");
          $this.$http.post(url,formData).then(async (res) => {
            if (res.data.code === 280) {
              if (res.data.data[0]["number_1711505160101_Zy3nM"] < 100) {
                $this.$message.error("【" + res.data.data[0]["input_1711439260720_6QPqX"] + "】任务进度未完成");
              } else {
                let xmjl = ""
                let xmjlId = ""
                let formData2 = new FormData();
                let tempWhere2 = [{
                  "key": $this.$util.uuid(),
                  "str": "commonNumber_1755322221490_jdSWe",
                  "condition": "eq",
                  "t_value": res.data.data[0]["input_1718345101976_ZNGth"],
                  "whId": "146e94d14bee3637cf5bda8953c02ee2",
                  "type": "head"
                }]
                formData2.append("where", JSON.stringify(tempWhere2));
                formData2.append("authority", "false");
                // 根据表单应用标识
                await $this.$http.post('/wind/tableByWhId/146e94d14bee3637cf5bda8953c02ee2', formData2).then(res => {
                  if (res.data.code === 280) {
                    let data = res.data.list;
                    xmjl = data[0].systemSelect_1753889252822_fmnil;
                    xmjlId = data[0].systemSelect_1753889252822_fmnil_ID;
                  } else {
                    $this.$message.error(res.data.msg ? res.data.msg : $this.$t('result.error.common.msg'));
                  }
                }).catch(e => {
                  $this.$message.error(e.message);
                });
                let id = $this.$util.uuid();
                let saveTask = {
                  "bill_id": id,
                  "bill_no": $this.$util.uuid(),
                  "bill_type": "a8ccd5df2e29ddee6c11f52d033fb812",
                  "create_company_id": $this.$store.state.user.user.companyId,
                  "create_company_name": $this.$store.state.user.user.companyName,
                  "create_date": $this.$util.getFormatDate(),
                  "create_dept_id": $this.$store.state.user.user.organizationId,
                  "create_dept_name": $this.$store.state.user.user.organizationName,
                  "create_user_id": $this.$store.state.user.user.userId,
                  "create_user_name": $this.$store.state.user.user.nickName,
                  "input_1711511883229_K1CSv": res.data.data[0]["commonNumber_1711532225675_bFKuy"],//任务编号
                  "input_1711511885245_bPKSS": res.data.data[0]["input_1711439260720_6QPqX"],//任务名称
                  "input_1711511891711_0MHzG": res.data.data[0]["systemSelect_1711504973428_U0If2"],//派发人
                  "input_1711511895002_4cA9a": res.data.data[0]["systemSelect_1711439399614_qXQ72"],//负责人
                  "input_1711512076065_Bnjyx": res.data.data[0]["bill_id"],//任务ID
                  "input_1711613718998_wsgUf": res.data.data[0]["input_1711505053915_0ebmW"],//提交时间
                  "input_1712807068685_m72Gk": res.data.data[0]["systemSelect_1711439399614_qXQ72_ID"],//执行人ID
                  "systemSelect_1755335343088_tlKt7": res.data.data[0]["systemSelect_1711439400905_v5lzI"],//审核人
                  "systemSelect_1755335343088_tlKt7_ID": res.data.data[0]["systemSelect_1711439400905_v5lzI_ID"],//审核人ID
                  "input_1755505311352_NPuVI": res.data.data[0]["input_1718345101976_ZNGth"],//项目编号
                  "input_1755505312916_MOLTZ": res.data.data[0]["input_1718345101976_PBcTl"],//项目名称
                  "select_1761115990017_gXoiU": res.data.data[0]["select_1711505903223_YWk8w"],//任务类型
                  "systemSelect_1761191649666_6KMrS": xmjl,//项目经理
                  "systemSelect_1761191649666_6KMrS_ID": xmjlId,//项目经理ID
                }

                let files = []
                let formData1 = new FormData()
                formData1.append('obj', JSON.stringify(saveTask))
                formData1.append("files", JSON.stringify(files))
                $this.$http.post("/wind/form/save/" + "review" + "/" + "add", formData1).then(res1 => {
                  if (res1.data.code === 280) {
                    $this.$http.post("/activiti/createFlow/" + "a8ccd5df2e29ddee6c11f52d033fb812" + "/" + id).then(res2 => {
                      if (res2.data.code === 280) {
                        let url1 = $this.$util.getAPI_URL();
                        url1 = url1.replace("api", "task/updateTaskStatus");
                        formData.append("status", "3");
                        $this.$http.post(url1, formData).then((resa) => {
                          if (resa.data.code === 280) {
                            $this.$message.success("提交成功")
                            $this.refreshFather(true);

                          } else {
                            $this.$message.error("提交失败")
                          }
                        })
                      } else {
                        $this.$message.error("发起【审核】流程失败")
                      }
                    }).catch(e => {
                      $this.$message.error(e.message)
                    });
                  } else {
                    $this.$message.errr("系统错误，请联系管理员!!!");
                  }
                }).catch(e => {
                  $this.$message.error(e.message);
                });
              }
            }
          })
        }
      }
*/